<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<!-- 下拉框 -->
<link rel="stylesheet" href="static/ace/css/chosen.css" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>业务类别维护</title>
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		
		<link rel="stylesheet" href="static/ace/css/bootstrap.css" />
		<link rel="stylesheet" href="static/ace/css/font-awesome.css" />
		
		<!-- text fonts -->
		<link rel="stylesheet" href="static/ace/css/ace-fonts.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="static/ace/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js" />
		<script type="text/javascript">
			$(top.hangge());
		</script>
		<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>
<body class="no-skin">
	<div class="main-container" id="main-container">
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<form action="transportClause/list" method="post" name="transportClauseForm" id="transportClauseForm">
											<fieldset>
											<table style="margin-top:5px;"class="table table-striped table-bordered table-hover">
											<tr>
												<td style="width:79px;text-align: right;padding-top: 13px;">快速检索码：</td>
												
												<td><input type="text" name="FAST_SEARCH_CODE" id="FAST_SEARCH_CODE" value="${pd.USERNAME }" maxlength="32" style="width:98%;"/></td>
<!-- 												<td style="width:79px;text-align: right;padding-top: 13px;">是否可用：</td> -->
<%-- 												<td><input type="text" name="ENABLE" id="ENABLE" value="${pd.USERNAME }" maxlength="32" style="width:98%;"/></td> --%>
														
														<td style="width:79px;text-align: right;padding-top: 13px;">是否可用：</td>
														<td>
														<select style="width:195px;"name="ENABLE">
														<option value=""></option>
														  <option value="1">是</option>
														  <option value="0">否</option>
														</select>
														</td>
												<td style="width:79px;text-align: right;padding-top: 13px;">起始条款：</td>
												<td><input type="text" name="START_CLAUSE" id="START_CLAUSE" value="${pd.USERNAME }" maxlength="32"  style="width:98%;"/></td>
												<td style="width:79px;text-align: right;padding-top: 13px;">终止条款：</td>
												<td><input type="text" name="END_CLAUSE" id="END_CLAUSE" value="${pd.USERNAME }" maxlength="32" style="width:98%;"/></td>
											</tr>
											<tr>
												<td style="width:79px;text-align: right;padding-top: 13px;">备注：</td>
												<td><textarea id="REMARK" name="REMARK"style="width:98%;"></textarea></td>
												<td style="text-align: left;" colspan="10">
												<a class="btn btn-xs btn-success">
													<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="add();">添加</i>
												</a>
											</td>
											</tr>
											<tr>
											
										</tr>
											</table>
											</fieldset>
											</form>
											<form action="transportClause/list" method="post" name="transportClause" id="transportClause">
											<fieldset>
											<table style="margin-top:5px;"class="table table-striped table-bordered table-hover">
											<tr>
												<td style="width:79px;text-align: right;padding-top: 13px;">起始条款：</td>
												<td><input type="text"  id="start" name="START_CLAUSE" maxlength="32" style="width:98%;"/></td>
												<td style="width:79px;text-align: right;padding-top: 13px;">终止条款：</td>
												<td><input type="text"  id="end" name = "END_CLAUSE" maxlength="32" style="width:98%;"/></td>
												<td style="text-align: left;" colspan="10">
												<a class="btn btn-xs btn-success">
													<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="serch();">查询</i>
												</a>
											</td>
											</tr>
											</table>
											</fieldset>
											</form>
											<fieldset>
											
											<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
												<thead>
													<tr>
														<th class="center">起始条款</th>
														<th class="center">终止条款</th>
														<th class="center">是否可用</th>
														<th class="center">检索码</th>
														<th class="center">备注</th>
														<th class="center">修改</th>
														<th class="center">删除</th>
													</tr>
												</thead>
												<tbody>
													<c:choose>
														<c:when test="${not empty transport}">
															<c:forEach items="${transport}" var="transport" varStatus="vs">
																<tr id="trId">
<!-- 																	<td class="dbclicktd" style="width: 30px;"> -->
<%-- 																			<label><input type='checkbox' value="${transport.ID }" id="ids"name="ids"class="ace"/><span class="lbl"></span></label> --%>
																			
<!-- 																		</td> -->
																		<td class="center"  id="td1">${transport.START_CLAUSE}</td>
																		<td class='center' style="width: 30px;"id="td2">${transport.END_CLAUSE}</td>
																		<c:if test="${transport.ENABLE ==1}">
																		<td class="center"id="td5">是</td>
																		</c:if>
																		<c:if test="${transport.ENABLE ==0}">
																		<td class="center" id="td5">否</td>
																		</c:if>
																		<td class="center" id="td3">${transport.FAST_SEARCH_CODE}</td>
																		<td class="center"id="td4">${transport.REMARK}</td>
																		<td class="center">
																		<div class="hidden-sm hidden-xs btn-group">
																			<a class="btn btn-xs btn-success" onclick="edit('${transport.ID}');">
																				<i class="ace-icon fa fa-pencil-square-o bigger-120">修改</i>
																			</a>
																		</div>
																		</td>
																		<td class="center">
																		<div class="hidden-sm hidden-xs btn-group">
																			<a class="btn btn-xs btn-success"onclick="deleteInfo('${transport.ID}');">
																				<i class="ace-icon fa fa-trash-o bigger-120">删除</i>
																			</a>
																		</div>
																		</td>						
																	</tr>
															</c:forEach>
														</c:when>
													</c:choose>
												</tbody>
											</table>
											<fieldset>
										
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
function add(){
	if($("#FAST_SEARCH_CODE").val()==""){
		$("#FAST_SEARCH_CODE").tips({
			side:3,
            msg:'请填写快速检索码',
            bg:'#AE81FF',
            time:2
        });
		$("#FAST_SEARCH_CODE").focus();
		$("#FAST_SEARCH_CODE").val('');
		$("#FAST_SEARCH_CODE").css("background-color","white");
		return false;
	}
	if($("#ENABLE").val()==""){
		$("#ENABLE").tips({
			side:3,
            msg:'请填写是否可用',
            bg:'#AE81FF',
            time:2
        });
		$("#ENABLE").focus();
		$("#ENABLE").val('');
		$("#ENABLE").css("background-color","white");
		return false;
	}
	if($("#START_CLAUSE").val()==""){
		$("#START_CLAUSE").tips({
			side:3,
            msg:'请填写起始条款',
            bg:'#AE81FF',
            time:2
        });
		$("#START_CLAUSE").focus();
		$("#START_CLAUSE").val('');
		$("#START_CLAUSE").css("background-color","white");
		return false;
	}
	if($("#END_CLAUSE").val()==""){
		$("#END_CLAUSE").tips({
			side:3,
            msg:'请填写终止条款',
            bg:'#AE81FF',
            time:2
        });
		$("#END_CLAUSE").focus();
		$("#END_CLAUSE").val('');
		$("#END_CLAUSE").css("background-color","white");
		return false;
	}
	 $.ajax({
         type: "POST",
         url: '<%=basePath%>transportClause/addTransportClauseInfo',
         data: $("#transportClauseForm").serialize(),
         dataType: 'json',
         cache: false,
         success: function (data) {
        	 alert("保存成功")
        	 window.location.reload();
        	 
         }
     });
}
function edit(ID){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="编辑";
	 diag.URL = '<%=basePath%>transportClause/updateTransportClauseInfo?ID='+ID;
	 diag.Width = 469;
	 diag.Height = 510;
	 diag.CancelEvent = function(){ //关闭事件
 		window.location.reload();
		diag.close();
	 };
	 diag.show();
}
function deleteInfo(ID){
	$.ajax({
        type: "POST",
        url: '<%=basePath%>transportClause/deleteTransportClauseInfo?ID='+ID,
        dataType: 'json',
        cache: false,
        success: function (data) {
       	 window.location.reload();
       	 
        }
    });
}
function serch(){
top.jzts();
$("#transportClause").submit();
}
</script>
</html>